package io.renren.modules.admin.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.renren.modules.admin.entity.CourseVideoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 视频表
 * 
 * @author Mark
 * @email sunlightcs@gmail.com
 * @date 2019-12-25 17:04:53
 */
@Mapper
public interface CourseVideoDao extends BaseMapper<CourseVideoEntity> {

    @Select("<script>" +
            "SELECT c.course_title as course_title ,a.course_title as up_down_title ,b.course_title as program ,v.video_url ,v.course_video_id,v.remark,v.order_num , b.course_id ,v.img ,c.course_title as course_title\n" +
            " FROM course as a INNER JOIN course as b on a.course_id = b.f_id " +
            " INNER JOIN course_video as v on v.course_id =  b.course_id " +
            " INNER JOIN course as c on a.f_id = c.course_id " +
            "<if test= \" courseId != null and courseId != '' \" > WHERE c.course_id =  #{courseId} </if>" +
            " order by order_num </script> ")
    IPage<CourseVideoEntity>  queryPage(IPage page, String courseId);

}
